package view;

import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;

import javax.swing.JButton;
import javax.swing.WindowConstants;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;

import controller.Maquina;
import controller.exception.MaquinaInstantiationException;

/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class CrearComodinElegirCantidad extends javax.swing.JPanel {
	private JLabel jLabel1;
	private JLabel jLabel2;
	private JButton jButton1;
	private JTextField jTextField1;
	private static CrearComodinElegirCantidad instancia;

	/**
	* Auto-generated main method to display this 
	* JPanel inside a new JFrame.
	*/
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		frame.getContentPane().add(new CrearComodinElegirCantidad());
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}
	
	private CrearComodinElegirCantidad() {
		super();
		initGUI();
	}
	
	public static CrearComodinElegirCantidad getInstancia()
	{
		if (instancia == null)
			instancia = new CrearComodinElegirCantidad();
		return instancia;
	}
	
	private void initGUI() {
		try {
			this.setPreferredSize(new java.awt.Dimension(400, 142));
			this.setLayout(null);
			{
				jLabel1 = new JLabel();
				this.add(jLabel1);
				jLabel1.setText("Elije cantidad de casillas");
				jLabel1.setBounds(137, 5, 213, 16);
			}
			{
				jLabel2 = new JLabel();
				this.add(jLabel2);
				jLabel2.setText("Casillas");
				jLabel2.setBounds(60, 66, 51, 16);
			}
			{
				jTextField1 = new JTextField();
				this.add(jTextField1);
				jTextField1.setBounds(229, 63, 110, 23);
			}
			{
				jButton1 = new JButton();
				this.add(jButton1);
				jButton1.setText("Siguiente Pantalla");
				jButton1.setBounds(229, 108, 132, 23);
			}
			
			jButton1.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent evt)
				{
					Integer cantCas=Integer.valueOf(jTextField1.getText());
					JFrame frame = new JFrame();
					frame.getContentPane().add(new CrearComodin(cantCas));
					frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
					frame.pack();
					frame.setVisible(true);
				}
			});
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
